<template>
    <div class="page">
        <headerTitle></headerTitle>
        <div class="vipBox">
          <img src="/static/img/vipBanner.png" v-show="imgShow" alt="">
            <iframe name="asdf" :src="urls" frameborder="0" :style="{height: iframeWidth+'px'}"></iframe>
            <input type="text" placeholder="粘贴视频播放网址" ref="urlPath">
          
            <select v-model="selects" @change="kks">
                        <option v-for="option in options" v-bind:value="option.url">
                            {{ option.name }}
                        </option>
                     </select>
            <a @click.stop="sousuo">立即播放</a>
            <div class="info">
                <span>如不能播放，请更换通道、刷新、或在PC端使用</span>
                <span>已支持以下网站视频播放(包含VIP电影)，直接填入电影的播放网址即可</span>
                <p>腾讯视频、爱奇艺、优酷视频、土豆视频、芒果TV、乐视视频、搜狐视频、华数TV、等主流视频网站</p>
            </div>
        </div>
        <bottomBtn></bottomBtn>
    </div>
</template>

<script type="text/ecmascript-6">
import bottomBtn from "../Modular/bottomBtn";
import headerTitle from "../Modular/headerTitle";
export default {
  data() {
    return {
      selects: "http://1717yun.duapp.com/letuan.php?url=",
      options: "",
      urlPath: "",
      imgShow:true,
      urls:
        "",
          iframeWidth:''
    };
  },
  components: {
    bottomBtn,
    headerTitle
  },
  methods: {
    kks: function() {
      // console.log(this.selects);
    },
    CheckUrl:function (str) {
    var RegUrl = new RegExp();
    RegUrl.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
    if (!RegUrl.test(str)) {
        return false;
    }
    return true;
},
    sousuo: function() {
      let that = this;
      let a = that.selects;
      let b = that.$refs.urlPath.value;
      if(!b || !that.CheckUrl(b)){
         that.$refs.urlPath.value=""
alert("请输入正确网址")
      }else{
    that.imgShow = false
      that.urls = a + b;
      }
  
      // console.log(that.urls);
    }
  },
  created() {
    let that = this;

      that.iframeWidth = $('iframe').innerWidth()
    $.ajax({
      url: "http://vapi.dicbs.cn/user/getserviceall",
      type: "get",
      success: function(data) {
          if(data.code == "200"){
//  console.log(data);
        that.options = data.data;
          }else{
              alert(data.memages)
          }
       
      }.bind(this)
    });
  },
  mounted(){
     let that = this
      that.iframeWidth = $('iframe').innerWidth()
  }
};
</script>

<style scoped>

</style>
